package com.chuangke.context.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.chuangke.common.http.HttpResult;
import com.chuangke.context.service.ContextService;

/**
 * @author chuangke
 * @date 2022-10-20
 */
@RestController
@RequestMapping("sys/manager")
public class SysManagerController {

	@Autowired
	private ContextService sysManagerService;

	@PreAuthorize("hasAuthority('login:action')")
	@GetMapping(value = "/deitdetaildept")
	public HttpResult deitDept() {
		return HttpResult.ok(sysManagerService.findUserDataDeptDetailData());
	}

	@PreAuthorize("hasAuthority('login:action')")
	@GetMapping(value = "/audittreedept")
	public HttpResult auditDept() {
		return HttpResult.ok(sysManagerService.findUserDataAndAuditDeptTreeData());
	}

	@PreAuthorize("hasAuthority('login:action')")
	@GetMapping(value = "/auditdetaildept")
	public HttpResult dataDept() {
		return HttpResult.ok(sysManagerService.findUserDataAndAuditDeptDetailData());
	}
	
	@PreAuthorize("hasAuthority('login:action')")
	@GetMapping(value = "/auditdetaildept1")
	public HttpResult dataDept(@RequestParam String type) {
		return HttpResult.ok(sysManagerService.findUserDataAndAuditDeptDetailData(type));
	}

	@PreAuthorize("hasAuthority('login:action')")
	@GetMapping(value = "/auditdetaildept2")
	public HttpResult dataDept(@RequestParam String type, String strc) {
		return HttpResult.ok(sysManagerService.findUserDataAndAuditDeptDetailData(type,strc));
	}
	@PreAuthorize("hasAuthority('login:action')")
	@GetMapping(value = "/auditdetaildept3")
	public HttpResult auditdetaildept3(String strc) {
		return HttpResult.ok(sysManagerService.findUserDataAndAuditDeptDetailData(strc,null,null));
	}
}
